Let's look at a few examples
(1) struct{int x; int y;} Test1;
Well, define the structure test1,
test1.x and test1.y can be used in the statement.
(2) struct test {int x; int y;} Test1;
Well, define the structure test1,
test1.x and test1.y can be
The use of a typedef
In C/s + + language, a typedef is commonly used to define an identifier and a keyword alias, which is part of the language compilation process, but it does not actually allocate memory space, as in the case of:
typedef int INT;
Usage and difference between typedef and # define
I. Usage of typedef
In C/C ++, typedef is often used to define an alias for an identifier and a keyword. It is part of the language compilation process, but it does not actually allocate memory
1 NO parameter macro definitionThe macro name of the parameterless macro is not followed by a parameter.The general form of its definition is:#define Identifier stringWhere the "#" indicates that this is a preprocessing command. All that begin with "
Usage of "#" and "#" in macroI. general usageWe use # to convert the macro parameter into a string, and # to combine the two macro parameters.Usage:# Include# IncludeUsing namespace STD;
# Define STR (s) # s# Define cons (a, B) int (A ## e ## B)
Int
Transferred from: http://www.cnblogs.com/kerwinshaw/archive/2009/02/02/1382428.htmlI. Usage of typedefA typedef is commonly used to define an identifier and an alias for a keyword in the C + + language, which is part of the language compilation
Usage and differentiation of typedef and # defineI. Usage of typedefA typedef is commonly used to define an identifier and an alias for a keyword in the C + + language, which is part of the language compilation process, but it does not actually
Section 2 Interface Definition
Technically, an interface is a set of data structures that contain functional methods. Through this set of data structures, the customerCodeYou can call the functions of component objects.
The interface is
Ifndef _i386_errno_h#define _i386_errno_h#define EPERM 1/* Operation not permitted * *#define ENOENT 2/* No such file or directory */#define ESRCH 3/* No such process * *#define EINTR 4/* Interrupted system call * *#define EIO 5 */I/O error *
# Ifndef # define # endif usage,
# Ifndef # define # endif usage
# Ifndef
# Ifndef in the header, which is critical. For example, you have two C files, both of which include the same header file. During compilation, these two C files need to be
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.